package cn.car91.activity;

import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebSettings.LayoutAlgorithm;
import android.webkit.WebView;
import android.widget.TextView;
import cn.car91.R;
import cn.car91.view.HerilyAlertDialog.Builder;

import com.lidroid.xutils.view.annotation.ViewInject;

public class RepairShopDescActivity extends BaseActivity {

  @ViewInject(R.id.repairshop_desc_content)
  WebView contentView;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    setContentView(R.layout.activity_repairshop_desc);
    super.onCreate(savedInstanceState);
    
    try {
      ((TextView) findViewById(R.id.header_text)).setText(getIntent().getStringExtra("repairshop_name"));
      
      String content = getIntent().getStringExtra("repairshop_desc");
      WebSettings webSettings = contentView.getSettings();
      webSettings.setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
      webSettings.setUseWideViewPort(true);
      webSettings.setLoadWithOverviewMode(true);
      webSettings.setJavaScriptEnabled(true);
      
      String style = "<style>img,p,div,table,fieldset,blockquote,section,span{max-width: 100%;height: auto;}</style>";
      contentView.loadDataWithBaseURL(getCar91Application().getCenterServerUrl(), "<meta name=\"viewport\" content=\"width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no\"/>"+style+content, "text/html", "utf-8", null);
    } catch (Exception e) {
      new Builder(this).setMessage("数据加载异常").create().show();;
    }
    
  }

}
